<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/_linkPages/basePath.jsp" %>
<!DOCTYPE html>
<%--发布信息--%>
<!-- saved from url=(0054)http://www.maomijiaoyi.com/index.php?/home/ReleasePost -->
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <title>猫咪交易网,买猫,卖猫,宠物猫交易第一站</title>
    <meta name="keywords" content="宠物猫,买猫,卖猫,宠物猫交易,宠物猫价格">
    <meta name="description"
          content="猫咪交易网(www.maomijiaoyi.com)行业购宠第一品牌，千万家卖猫商家入驻覆盖全国各地，买放心宠物猫、了解最全面的宠物猫价格就上猫咪交易网、12年品牌值得信赖！">

    <link rel="stylesheet" href="${basePath}jsp/hs/css/releasepost.css">
    <link rel="stylesheet" href="${basePath}jsp/hs/css/comment.css">
    <script src="${basePath}jsp/hs/js/jquery-1.11.3.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="${basePath}jsp/hs/js/comment.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="${basePath}jsp/hs/js/kindeditor-all-min.js"></script>
    <link href="${basePath}jsp/hs/css/default.css" rel="stylesheet">
    <style id="tsbrowser_video_independent_player_style" type="text/css">
        [tsbrowser_force_max_size] {
            width: 100% !important;
            height: 100% !important;
            left: 0px !important;
            top: 0px !important;
            margin: 0px !important;
            padding: 0px !important;
            transform: none !important;
        }

        [tsbrowser_force_fixed] {
            position: fixed !important;
            z-index: 9999 !important;
            background: black !important;
        }

        [tsbrowser_force_hidden] {
            opacity: 0 !important;
            z-index: 0 !important;
        }

        [tsbrowser_hide_scrollbar] {
            overflow: hidden !important;
        }

        [tsbrowser_display_none] {
            display: none !important;
            visibility: hidden !important;
            opacity: 0 !important;
        }

        [tsbrowser_force_show] {
            /*display: black !important;*/
            visibility: visible !important;
            opacity: 0;
        }</style>
</head>
<body style="background: #efefef;">

<!-- 引入公共头部 -->
<!-- 网页头部 -->
<%@ include file="cat/head.jsp"%>

<div style="height: 80px;"></div>

<!-- 面包屑导航栏 Crumbs_nav-->
<div id="Crumbs_nav">
    <a target="_blank" href="http://localhost:8080/jsp/hs/index.jsp">首页 &gt;</a>

    <a href="http://localhost:8080/jsp/lqj/catlogin.jsp"><span>发布信息</span> </a>

</div>

<!-- 禁止重复发布买卖信息ban_repeat -->
<div id="ban_repeat">发表帖子注意请不要重复发布买卖信息</div>

<!-- 发布信息说明 release_Explain-->
<div id="release_Explain">

    <p>※信息发布小帮手，让更多买家找到您！※</p>
    <p>①不要重复发布相同信息，使用“顶一下”可将信息排名提前，并且会在首页最新处展示！</p>
    <p>②标题长度为10~30个汉字。请不要在标题里添加一些特殊粗体符号，违者禁言三天！</p>
    <p>③若有多种猫咪出售，请按不同猫咪品种分别发布，这样会让买家在搜索信息的时候更容易查到您的信息！</p>
    <p>④详细介绍要多写些内容，如猫咪是否做过疫苗和驱虫、猫咪父母的介绍、售后服务等等，这些都是买家十分关注的！</p>

</div>

<!-- 发帖表单release_info -->
<div id="release_info">

    <form action="${basePath}rellInformation" method="post" enctype="multipart/form-data"
          id="regForm">

        <!-- 帖子标题 post_title-->
        <div id="post_title">

            <div class="left">帖子标题：</div>
            <input type="hidden" name="username" value="${user.username}">
            <input type="hidden" name="exit" value="exit">
            <input type="text" name="posttitle" id="cheacklen" onblur="cheacktitle()" placeholder="请输入帖子标题" value="${catPost2.posttitle}">

            <span id="showerr">标题长度为30字以内</span>

        </div>

        <div id="other_info">

            <div id="postdesc">
                帖子描述 :

                <input type="text" name="description" id="cheadesc" onblur="cheackdesc()" value="${catPost2.description}" placeholder="必填输入帖子相关描述100字以内">
            </div>

            <div class="Unified_style">

                <div class="left_box">

                    猫咪品种 :
                    <select name="catbreed" class="select_style">
                        <option value="">请选择</option>
                        <option ${catPost2.catbreed=='布偶猫'?'selected':''} value="布偶猫">布偶猫</option>
                        <option ${catPost2.catbreed=='加菲猫'?'selected':''}  value="加菲猫">加菲猫</option>
                        <option ${catPost2.catbreed=='金渐层'?'selected':''} value="金渐层">金渐层</option>
                        <option ${catPost2.catbreed=='英短蓝猫'?'selected':''} value="英短蓝猫">英短蓝猫</option>
                        <option ${catPost2.catbreed=='英短蓝白'?'selected':''} value="英短蓝白">英短蓝白</option>
                        <option ${catPost2.catbreed=='英国短毛猫'?'selected':''} value="英国短毛猫">英国短毛猫</option>
                        <option ${catPost2.catbreed=='美国短毛猫'?'selected':''} value="美国短毛猫">美国短毛猫</option>
                        <option ${catPost2.catbreed=='苏格兰折耳猫'?'selected':''} value="苏格兰折耳猫">苏格兰折耳猫</option>
                        <option ${catPost2.catbreed=='银渐层'?'selected':''} value="银渐层">银渐层</option>
                        <option ${catPost2.catbreed=='异国短毛猫'?'selected':''} value="异国短毛猫">异国短毛猫</option>
                        <option ${catPost2.catbreed=='孟买猫'?'selected':''} value="孟买猫">孟买猫</option>
                        <option ${catPost2.catbreed=='暹罗猫'?'selected':''} value="暹罗猫">暹罗猫</option>
                        <option ${catPost2.catbreed=='孟加拉豹猫'?'selected':''} value="孟加拉豹猫">孟加拉豹猫</option>
                        <option ${catPost2.catbreed=='缅因猫'?'selected':''} value="缅因猫">缅因猫</option>
                        <option ${catPost2.catbreed=='金吉拉猫'?'selected':''} value="金吉拉猫">金吉拉猫</option>
                        <option ${catPost2.catbreed=='无毛猫'?'selected':''} value="无毛猫">无毛猫</option>
                        <option ${catPost2.catbreed=='高地折耳猫'?'selected':''} value="高地折耳猫">高地折耳猫</option>
                        <option ${catPost2.catbreed=='曼基康矮脚猫'?'selected':''} value="曼基康矮脚猫">曼基康矮脚猫</option>
                        <option ${catPost2.catbreed=='波斯猫'?'selected':''} value="波斯猫">波斯猫</option>
                        <option ${catPost2.catbreed=='橘猫'?'selected':''} value="橘猫">橘猫</option>
                        <option ${catPost2.catbreed=='阿比西尼亚猫'?'selected':''} value="阿比西尼亚猫">阿比西尼亚猫</option>
                        <option ${catPost2.catbreed=='德文卷毛猫'?'selected':''} value="德文卷毛猫">德文卷毛猫</option>

                    </select>

                </div>

                <div class="right_box">
                    联系人 　:
                    <input type="text" name="people" id="Contacts" value="${catPost2.people}" onblur="cheackContacts()" class="text_style"
                           placeholder="10个字符以内">
                </div>

            </div>

            <div class="Unified_style">

                <div class="left_box">

                    猫咪性别 :
                    <select name="catgender" class="select_style">
                        <option  value="">请选择</option>
                        <option ${catPost2.catgender=='公猫'?'selected':''} value="公猫">公猫</option>
                        <option ${catPost2.catgender=='母猫'?'selected':''} value="母猫">母猫</option>
                        <option ${catPost2.catgender=='公母猫都有'?'selected':''} value="公母猫都有">公母猫都有</option>
                    </select>

                </div>
                <div class="right_box">
                    联系电话 :
                    <input type="text" name="tel" value="${catPost2.tel}" onblur="cheackphone()" id="phonenum"
                           class="text_style">
                </div>


            </div>

            <div class="Unified_style">

                <div class="left_box">

                    猫咪年龄 :
                    <select name="catsge" class="select_style">
                        <option value="">请选择</option>
                        <option ${catPost2.catsge==1?'selected':''} value="1">一个月</option>
                        <option ${catPost2.catsge==2?'selected':''} value="2">两个月</option>
                        <option ${catPost2.catsge==3?'selected':''} value="3">三个月</option>
                        <option ${catPost2.catsge==4?'selected':''} value="4">四个月</option>
                        <option ${catPost2.catsge==5?'selected':''} value="5">五个月</option>
                        <option ${catPost2.catsge==6?'selected':''} value="6">六个月</option>
                        <option ${catPost2.catsge==7?'selected':''} value="7">七个月</option>
                        <option ${catPost2.catsge==8?'selected':''} value="8">八个月</option>
                        <option ${catPost2.catsge==9?'selected':''} value="9">九个月</option>
                        <option ${catPost2.catsge==10?'selected':''} value="10">十个月</option>
                        <option ${catPost2.catsge==11?'selected':''} value="11">十一个月</option>
                        <option ${catPost2.catsge==12?'selected':''} value="12">一年多</option>
                        <option ${catPost2.catsge==24?'selected':''} value="24">两年多</option>
                        <option ${catPost2.catsge==36?'selected':''} value="36">三年多</option>
                    </select>

                </div>
                <div class="right_box">

                    联系 QQ :

                    <input type="text" name="qq" value="${catPost2.qq}" onblur="cheackQQ()" id="Contact_QQ"
                           class="text_style">
                </div>

            </div>

            <div class="Unified_style">

                <div class="left_box">

                    疫苗情况 :
                    <select name="ym" class="select_style">
                        <option value="">请选择</option>
                        <option ${catPost2.ym=='3针疫苗'?'selected':''} value="3针疫苗">3针疫苗</option>
                        <option ${catPost2.ym=='2针疫苗'?'selected':''} value="2针疫苗">2针疫苗</option>
                        <option ${catPost2.ym=='1针疫苗'?'selected':''} value="1针疫苗">1针疫苗</option>
                        <option ${catPost2.ym=='未打疫苗'?'selected':''} value="未打疫苗">未打疫苗</option>
                    </select>

                </div>
                <div class="right_box">

                    微信账号 :
                    <input type="text" name="wechat" value="${catPost2.wechat}" onblur="cheackwx()" id="Contact_WeChat"
                           class="text_style">
                </div>


            </div>

            <div class="Unified_style">

                <div class="left_box">

                    驱虫情况 :
                    <select name="qc" class="select_style">
                        <option value="">请选择</option>
                        <option ${catPost2.qc=='已驱虫'?'selected':''} value="已驱虫">已驱虫</option>
                        <option ${catPost2.qc=='未驱虫'?'selected':''} value="未驱虫">未驱虫</option>
                    </select>

                </div>
                <div class="right_box">

                    待售数量 :

                    <input type="text" name="dsnum" onblur="salenum()" value="${catPost2.dsnum}" id="salenum1"
                           class="text_style">
                </div>

            </div>

            <div class="Unified_style">

                <div class="left_box">

                    异地运费 :
                    <select name="money" class="select_style">
                        <option value="">请选择</option>
                        <option ${catPost2.money==0?'selected':''} value="包运费！签协议！">包运费！签协议！</option>
                        <option ${catPost2.money!=0?'selected':''} value="不包邮">不包邮</option>
                    </select>

                </div>

                <div class="right_box">

                    猫咪价格 :
                    <input type="text" name="catpice" value="${catPost2.catpice}" onblur="pricenum()" id="pricenum1" class="text_style">
                </div>

            </div>

            <div class="Unified_style">

                <div class="left_box">

                    是否纯种 :
                    <select name="cz" class="select_style">
                        <option value="">请选择</option>
                        <option ${catPost2.cz=='纯种'?'selected':''} value="纯种">是纯种</option>
                        <option ${catPost2.cz=='不是纯种'?'selected':''} value="不是纯种">不是纯种</option>
                    </select>

                </div>

                <%--                <div class="right_box">--%>

                <%--                    保障服务 :--%>
                <%--                    <input type="text" name="cat_guarantee_service" id="service" onblur="cheackser()" value=""--%>
                <%--                           placeholder="15个字以内" class="text_style">--%>
                <%--                </div>--%>

            </div>

            <!-- 错误提示 pubshowerr-->
            <div id="pubshowerr"></div>

            <!--上传图片 封面图 图片描述upload_img-->
            <div id="upload_img">

                <img src="img/uploadimg.png" alt="" class="uploadimg" target="pic1" name="pic1">
                <img src="img/uploadimg.png" alt="" class="uploadimg" target="pic2" name="pic2">
                <img src="img/uploadimg.png" alt="" class="uploadimg" target="pic3" name="pic3">
                <img src="img/uploadimg.png" alt="" class="uploadimg" target="pic4" name="pic4">

                <input type="file" name="pic1" style="display:none;" value="浏览">
                <input type="file" name="pic2" style="display:none;" value="浏览">
                <input type="file" name="pic3" style="display:none;" value="浏览">
                <input type="file" name="pic4" style="display:none;" value="浏览">


            </div>

            <script>

                $("#upload_img .uploadimg").click(function () {

                    var file = $("input[name=" + $(this).attr("target") + "]");
                    file.click();

                });


                var $files = $("input[type=file]");

                for (i = 0; i < $files.length; i++) {

                    $files[i].onchange = function (e) {

                        var f = e.srcElement.files[0];

                        $('img[target=' + $(e.srcElement).attr('name') + ']').attr('src', 'application/views/TPL_SIMPLE/imgs/uploadimg.png');

                        if (Math.floor(f.size / 1024) > 128) {

                            $('#pubshowerr').html('文件大小超过128Kb,请重新选择合适的图片！');
                            return false;

                        }

                        if (!/image\/jpeg/.test(f.type) && !/image\/png/.test(f.type) && !/image\/gif/.test(f.type)) {

                            $('#pubshowerr').html('文件类型不符合!');
                            return;
                        }

                        var reader = new FileReader();

                        reader.onload = function (ee) {

                            $('img[target=' + $(e.srcElement).attr('name') + ']').attr('src', this.result);

                        }
                        reader.readAsDataURL(this.files[0]);
                    }
                }


            </script>


            <!-- 本站帖子价格说明 price_img_Explain-->
            <div id="price_img_Explain">

                <p>注：价格说明：本站:宠物猫价格必须填写2000以上 </p>
                <p>图片1为信息封面图片，该图片必须为当前猫咪品种照片，不可多个照片组合拼成，不可有相框边框，</p>
                <p>图片上文字只可为猫舍名称、电话、QQ且字体不可过大颜色不可太明艳，违规者将被删除图片（包括VIP会员）！</p>
                <p>有效文件类型:jpg|jpeg|gif|png:512KB;</p>

            </div>

            <!--编辑器 帖子描述post_content_box-->

            <!--编辑器 帖子描述结束-->

            <!-- 提交按钮sub_box -->
            <div onclick="cheackinput()" id="sub_box">提　交</div>

        </div>

    </form>

</div>

<div style="height: 80px;"></div>

<!-- 引入公共尾部 -->
<!-- 网页底部 -->
<div id="footer">

    <div class="logo">
        <div class="logo_kuang">
            <div>
                <a href="http://localhost:8080/jsp/hs/index.jsp">
                    <img alt="猫咪交易网" title="猫咪交易网" src="img/logo.png">
                </a>
            </div>
        </div>
    </div>

    <div class="banquan">
        <div class="center_1220">
            版权所有：猫咪交易网 www.maomijiaoyi.com 友情链接互换:qq 3416807849
        </div>
    </div>

    <div class="banquan">
        <div class="center_1220">
            【免责声明：本站所有猫猫交易信息内容系用户自行发布，其真实性、合法性由发布人负责，本站不提供任何保证，亦不承担任何法律责任！】
        </div>
    </div>

    <div class="banquan">
        <div class="center_1220">
            <a style="color: #FFF;" href="http://www.beian.gov.cn/portal/registerSystemInfo" target="_blank">
                <img src="img/foot_link3.png">
                沪ICP备18022709号-1 </a>
        </div>
    </div>

</div>

<!-- 编辑器引用的js -->
<script type="text/javascript">

    KindEditor.ready(function (K) {
        var editor1 = K.create('textarea[name="post_content"]', {
            cssPath: '/application/views/TPL/kindeditor/plugins/code/prettify.css',
            uploadJson: '/sb.php',
            allowFileManager: false,
            resizeType: 0,
            allowPreviewEmoticons: false,
            allowImageUpload: true,
            filterMode: false,
            allowFileManager: false,
            allowImageManager: true,

            items: [
                "source",
                "|",
                "undo",
                "redo",
                "|",
                "preview",
                "print",
                "template",
                "code",
                "cut",
                "copy",
                "paste",
                "plainpaste",
                "wordpaste",
                "|",
                "justifyleft",
                "justifycenter",
                "justifyright",
                "justifyfull",
                "insertorderedlist",
                "insertunorderedlist",
                "indent",
                "outdent",
                "subscript",
                "superscript",
                "clearhtml",
                "quickformat",
                "selectall",
                "|",
                "fullscreen",
                "/",
                "formatblock",
                "fontname",
                "fontsize",
                "|",
                "forecolor",
                "hilitecolor",
                "bold",
                "italic",
                "underline",
                "strikethrough",
                "lineheight",
                "removeformat",
                "|",
                //  "image",
                //  "multiimage",
                //  "flash",
                //  "media", 
                "table",
                "hr",
                "emoticons",
                "baidumap",
                "pagebreak",
                "|",
                "about"
            ],

            afterUpload: function () {
                this.sync();
            }, //图片上传后，将上传内容同步到textarea中
            afterBlur: function () {
                this.sync();
            },   //失去焦点时，将上传内容同步到textarea中
            afterCreate: function () {
                this.sync();  //焦点问题，这里不写会出问题.同步KindEditor的值到textarea文本框
                var self = this;
                K.ctrl(document, 13, function () {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });

                K.ctrl(self.edit.doc, 13, function () {
                    self.sync();
                    K('form[name=example]')[0].submit();
                });
            }
        });
        //prettyPrint();
    });


    //验证帖子标题长度30字以内
    function cheacktitle() {
        var cheacklength = document.getElementById("cheacklen").value;
        if (cheacklength.length > 30) {
            document.getElementById("showerr").innerHTML = '***标题超出长度范围***';
            //       document.getElementById("cheacklen").value='';
            return false;
        } else {
            document.getElementById("showerr").innerHTML = '***标题长度为30个汉字以内***';
            return true;
        }
    }


    //验证帖子描述
    function cheackdesc() {
        var cheadesclen = document.getElementById("cheadesc").value;
        if (cheadesclen.length > 100) {
            document.getElementById("pubshowerr").innerHTML = '帖子描述超出长度范围';
            //        document.getElementById("cheadesc").value='';
            return false;
        } else {
            document.getElementById("pubshowerr").innerHTML = '';
            return true;
        }
    }

    //验证联系人10字符以内
    function cheackContacts() {
        var Contactslength = document.getElementById("Contacts").value;
        if (Contactslength.length > 10) {
            document.getElementById("pubshowerr").innerHTML = '联系人超出长度范围';
            //       document.getElementById("Contacts").value='';
            return false;
        } else {
            document.getElementById("pubshowerr").innerHTML = '';
            return true;
        }
    }

    //验证保障服务15字符以内
    // function cheackser() {
    //     var servicelength = document.getElementById("service").value;
    //     if (servicelength.length > 15) {
    //         document.getElementById("pubshowerr").innerHTML = '保障服务超出长度范围';
    //         //       document.getElementById("service").value='';
    //         return false;
    //     } else {
    //         document.getElementById("pubshowerr").innerHTML = '';
    //         return true;
    //     }
    // }

    //联系电话验证
    function cheackphone() {
        var phonenumlength = document.getElementById("phonenum").value;
        var cheack2 = new RegExp(/^((\d{3,4})|\d{3,4}-)?\d{7,8}$/);
        if (cheack2.test(phonenumlength)) {
            document.getElementById("pubshowerr").innerHTML = '';
            return true;
        } else {
            document.getElementById("pubshowerr").innerHTML = '电话号码格式不正确';
            //       document.getElementById("phonenum").value='';
            return false;
        }
    }

    //验证QQ onblur="cheackQQ()" id="Contact_QQ"
    function cheackQQ() {
        var Contact_QQlength = document.getElementById("Contact_QQ").value;
        var bValidate = RegExp(/^[1-9][0-9]{4,13}$/).test(Contact_QQlength);
        if (bValidate) {
            document.getElementById("pubshowerr").innerHTML = '';
            return true;
        } else {
            document.getElementById("pubshowerr").innerHTML = '请输入正确QQ';
            //       document.getElementById("Contact_QQ").value='';
            return false;
        }
    }

    //验证微信 onblur="cheackwx" id="Contact_WeChat"
    function cheackwx() {
        var Contact_WeChatlength = document.getElementById("Contact_WeChat").value;
        if (Contact_WeChatlength.length > 20) {
            document.getElementById("pubshowerr").innerHTML = '请输入正确的微信号';
            //       document.getElementById("Contact_WeChat").value='';
            return false;
        } else {
            document.getElementById("pubshowerr").innerHTML = '';
            return true;
        }
    }

    //验证价格 只能输入数字
    function pricenum() {
        var pricenum1 = document.getElementById("pricenum1").value;
        //匹配数字的正则表达式
        //var cheacknum  = new RegExp(/^\+?[1-9][0-9]*$/);
        var cheacknum = new RegExp(/^[1-9]\d{0,4}$/);
        if (cheacknum.test(pricenum1)) {
            document.getElementById("pubshowerr").innerHTML = '';
            return true;
        } else {
            document.getElementById("pubshowerr").innerHTML = '请输入正确的价格';
            //       document.getElementById("pricenum1").value='';
            return false;
        }
    }

    //验证待售数量 只能输入数字
    function salenum() {
        var salenum1 = document.getElementById("salenum1").value;
        //匹配数字的正则表达式
        var cheacksalenum = new RegExp(/^[1-9]\d{0,2}$/);
        if (cheacksalenum.test(salenum1)) {
            document.getElementById("pubshowerr").innerHTML = '';
            return true;
        } else {
            document.getElementById("pubshowerr").innerHTML = '请输入正确的待售数量';
            //       document.getElementById("salenum1").value='';
            return false;
        }
    }


    // submit提交验证
    function cheackinput() {

        //验证标题
        var cheacklength = document.getElementById("cheacklen").value;
        if (cheacklength.length > 30) {
            document.getElementById("showerr").innerHTML = '***标题超出长度范围***';
            return false;
        }
        if (cheacklength.length <= 0) {
            document.getElementById("showerr").innerHTML = '***标题为空***';
            return false;
        }

        //验证帖子描述
        var cheadesclen = document.getElementById("cheadesc").value;
        if (cheadesclen.length > 100) {
            document.getElementById("pubshowerr").innerHTML = '帖子描述超出长度范围';
            return false;
        }

        if (cheadesclen.length <= 0) {
            document.getElementById("pubshowerr").innerHTML = '帖子描述为空';
            return false;
        }

        //验证猫咪品种
        if ($('select[name="catbreed"]').val() == '' || $('select[name="catbreed"]').val() <= 0) {
            document.getElementById("pubshowerr").innerHTML = '请选择猫咪品种';
            return false;
        }

        //验证联系人10字符以内
        var Contactslength = document.getElementById("Contacts").value;
        if (Contactslength.length > 10) {
            document.getElementById("pubshowerr").innerHTML = '联系人超出长度范围';
            return false;
        }
        if (Contactslength.length <= 0) {
            document.getElementById("pubshowerr").innerHTML = '联系人为空';
            return false;
        }

        //验证猫咪性别catgender
        if ($('select[name="catgender"]').val() == '' || $('select[name="catgender"]').val() < 0) {
            document.getElementById("pubshowerr").innerHTML = '请选择猫咪性别';
            return false;
        }

        //验证子城市
        if ($('select[name="cat_region_city"]').val() <= 0) {
            document.getElementById("pubshowerr").innerHTML = '请选择城市';
            return false;
        }

        //验证猫咪年龄
        if ($('select[name="catsge"]').val() == '' || $('select[name="catsge"]').val() < 0) {
            document.getElementById("pubshowerr").innerHTML = '请选择猫咪年龄';
            return false;
        }

        //验证电话号码
        var phonenumlength = document.getElementById("phonenum").value;
        if (phonenumlength.length <= 0) {
            document.getElementById("pubshowerr").innerHTML = '电话号为空';
            return false;
        }
        var cheack2 = new RegExp(/^((\d{3,4})|\d{3,4}-)?\d{7,8}$/);
        if (!cheack2.test(phonenumlength)) {
            document.getElementById("pubshowerr").innerHTML = '电话号码格式不正确';
            return false;
        }

        //验证猫咪疫苗ym
        if ($('select[name="ym"]').val() == '' || $('select[name="ym"]').val() < 0) {
            document.getElementById("pubshowerr").innerHTML = '请选择疫苗情况';
            return false;
        }

        //验证QQ
        var Contact_QQlength = document.getElementById("Contact_QQ").value;
        var bValidate = RegExp(/^[1-9][0-9]{4,13}$/).test(Contact_QQlength);
        if (!bValidate) {
            document.getElementById("pubshowerr").innerHTML = '请输入正确QQ';
            return false;
        }
        if (Contact_QQlength.length <= 0) {
            document.getElementById("pubshowerr").innerHTML = '请输入正确QQ';
            return false;
        }

        //验证猫咪驱虫qc
        if ($('select[name="qc"]').val() == '' || $('select[name="qc"]').val() < 0) {
            document.getElementById("pubshowerr").innerHTML = '请选择驱虫情况';
            return false;
        }

        //验证微信
        var Contact_WeChatlength = document.getElementById("Contact_WeChat").value;
        if (Contact_WeChatlength.length > 20) {
            document.getElementById("pubshowerr").innerHTML = '请输入正确的微信号';
            return false;
        }
        if (Contact_WeChatlength.length <= 0) {
            document.getElementById("pubshowerr").innerHTML = '微信号为空';
            return false;
        }

        //验证能否视频cat_video
//      if( $('select[name="cat_video"]').val() =='' || $('select[name="cat_video"]').val() < 0 ){
//          document.getElementById("pubshowerr").innerHTML='请选择能否视频';
//          return false;
//      }

        //验证价格
        var salenum1 = document.getElementById("salenum1").value;
        var cheacksalenum = new RegExp(/^[1-9]\d{0,2}$/);
        if (!cheacksalenum.test(salenum1)) {
            document.getElementById("pubshowerr").innerHTML = '请输入正确的待售数量';
            return false;
        }
        if (salenum1.length <= 0) {
            document.getElementById("pubshowerr").innerHTML = '待售数量为空';
            return false;
        }

        //验证异地运费money
        if ($('select[name="money"]').val() == '' || $('select[name="money"]').val() < 0) {
            document.getElementById("pubshowerr").innerHTML = '请选择运费情况';
            return false;
        }

        //验证价格
        var pricenum1 = document.getElementById("pricenum1").value;
        var cheacknum = new RegExp(/^[1-9]\d{0,4}$/);
        if (!cheacknum.test(pricenum1)) {
            document.getElementById("pubshowerr").innerHTML = '请输入正确的价格';
            return false;
        }
        if (pricenum1.length <= 0) {
            document.getElementById("pubshowerr").innerHTML = '价格为空';
            return false;
        }

        if (pricenum1 < 500) {
            document.getElementById("pubshowerr").innerHTML = '价格不符合条件';
            return false;
        }

        //验证猫咪是否纯种cz
        if ($('select[name="cz"]').val() == '' || $('select[name="cz"]').val() < 0) {
            document.getElementById("pubshowerr").innerHTML = '请选择是否纯种';
            return false;
        }

        //验证保障服务
        // var servicelength = document.getElementById("service").value;
        // if (servicelength.length > 15) {
        //     document.getElementById("pubshowerr").innerHTML = '保障服务超出长度范围';
        //     return false;
        // }
        // if (servicelength.length <= 0) {
        //     document.getElementById("pubshowerr").innerHTML = '保障服务为空';
        //     return false;
        // }


        //验证图片上传
        if ($('img[target="pic1"]').attr('src') == 'application/views/TPL_SIMPLE/imgs/uploadimg.png') {
            document.getElementById("pubshowerr").innerHTML = '请选择图片1';
            return false;
        }

        if ($('img[target="pic2"]').attr('src') == 'application/views/TPL_SIMPLE/imgs/uploadimg.png') {
            document.getElementById("pubshowerr").innerHTML = '请选择图片2';
            return false;
        }

        if ($('img[target="pic3"]').attr('src') == 'application/views/TPL_SIMPLE/imgs/uploadimg.png') {
            document.getElementById("pubshowerr").innerHTML = '请选择图片3';
            return false;
        }

        if ($('img[target="pic4"]').attr('src') == 'application/views/TPL_SIMPLE/imgs/uploadimg.png') {
            document.getElementById("pubshowerr").innerHTML = '请选择图片4';
            return false;
        }

        //验证帖子详情
        if ($('textarea[name="post_content"]').val() == '') {

            document.getElementById("pubshowerr").innerHTML = '请填写帖子详情';
            return false;
        }


        var regForm = document.getElementById('regForm');
        regForm.submit();
    }


</script>


<script type="text/javascript">
    $(document).ready(function () {

        $('select[name=cat_region_Province]').change(function () {
            var data = {city_id: $('select[name=cat_region_Province]').val()};
            if (data.city_id < 0) {
                $select = $('select[name=cat_region_city]').empty();
                $select.append('<option >请选择</option>');
                return;
            }
            $.post('/index.php?/home/getCity', data, function (rst) {
                try {
                    var cities = eval('(' + rst + ')');
                    $select = $('select[name=cat_region_city]').empty();
                    $select.append('<option value=0 >请选择</option>');
                    for (it in cities) {
                        //$select.append('');
                        $select.append('<option value="' + cities[it].city_id + '">' + cities[it].city_name + '</option>');
                    }

                } catch (e) {

                }
            });
        });
    });



</script>


</body>
</html>